package live.zs.jpaboot.controller;

import live.zs.jpaboot.dto.PageInfo;
import live.zs.jpaboot.entity.TbOrderEntity;
import live.zs.jpaboot.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

/**
 * @author madison
 * @description
 * @date 2021/7/8 23:30
 */
@RestController
@RequestMapping("/")
public class DataController {

    @Autowired
    private OrderService orderService;

    @GetMapping("list")
    public Page<TbOrderEntity> list(@RequestBody(required = false) PageInfo pageInfo) {
        return orderService.selectPage(pageInfo);
    }


    @PutMapping("save")
    public TbOrderEntity save(@RequestBody TbOrderEntity orderEntity) {
        return orderService.saveOrder(orderEntity);
    }
}
